import pymysql.cursors

connection = pymysql.connect(host='localhost',
                             user='root',
                             password='1234',
                             database='soft',
                             cursorclass=pymysql.cursors.DictCursor)
cursor=connection.cursor()
# 准备sql,三引号表示换行
sql = "select * from soft_table"
# 执行SQL语句
cursor.execute(sql)

# 获取所有记录列表
results = cursor.fetchall()

# 打印结果
for row in results:
    print(row)
